
import MaterialProperty from '../../MaterialProperty'

class PolylineTrailMaterialProperty extends MaterialProperty {
  constructor(options = {}) {
    super(options)
    this.repeat = options.repeat || 1.0
  }

  // 获取类型
  getType(time) {
    return Cesium.Material.PolylineTrailMaterialType
  }

  getValue(time, result) {
    if (!result) {
      result = {}
    }
    result.color = Cesium.Property.getValueOrUndefined(this.color, time)
    result.image = Cesium.Property.getValueOrUndefined(this.image, time)
    result.repeat = Cesium.Property.getValueOrUndefined(this.repeat, time)
    return result
  }

  equals(other) {
    return this === other
  }
}

Object.defineProperties(PolylineTrailMaterialProperty.prototype, {
  color: Cesium.createPropertyDescriptor('color'),
  speed: Cesium.createPropertyDescriptor('speed'),
  repeat: Cesium.createPropertyDescriptor('repeat')
})

export default PolylineTrailMaterialProperty